package org.kia.activity;

import java.util.List;

import org.kia.R;
import org.kia.activity.adapters.SearchListAdapter;
import org.kia.activity.interfaces.SearchActivityInterface;
import org.kia.data.model.CategoryModel;
import org.kia.manager.SearchManager;

import android.os.Bundle;
import android.widget.AutoCompleteTextView;
import android.widget.ListView;

/**
 * Kia Search places
 * 
 * @author Amir Lazarovich & Keren Kalev
 */
public class SearchActivity extends KiaActivity<SearchManager> implements SearchActivityInterface {

	//////////////////////////////////////////////
	// Constants
	//////////////////////////////////////////////
	private static final String TAG = "SearchActivity";
	
	//////////////////////////////////////////////
	// Members
	//////////////////////////////////////////////
	private AutoCompleteTextView mSearchbar;
	private ListView mList;
	
	//////////////////////////////////////////////
	// Activity flow & initializers
	//////////////////////////////////////////////
	
	@Override
    public void onCreate(Bundle savedInstanceState) {
        setContentView(R.layout.search_main);
        // It is important to call its super only after setting the content view
        // due to our construction of KiaActivity
        super.onCreate(savedInstanceState);
    }

	/**
	 * Initialize manager
	 */
	protected void initManager() {
		mManager = SearchManager.getInstance();
		mManager.onActivityReady(this);
	}
	
	/**
	 * Initialize all members
	 */
	protected void initMembers() {
		mSearchbar = (AutoCompleteTextView) findViewById(R.id.search_topbar);
		mList = (ListView) findViewById(R.id.search_list);
		SearchListAdapter<CategoryModel> adapter = new SearchListAdapter<CategoryModel>(this);
		mList.setAdapter(adapter);
	}

	/**
	 * Initialize all listeners
	 */
	protected void initListeners() {
		
	}

	//////////////////////////////////////////////
	// Overrides & Implementation
	//////////////////////////////////////////////
	
//	@SuppressWarnings({ "unchecked", "rawtypes" })
//	@Override
//	public void setCategories(List<CategoryModel> data) {
//		((SearchListAdapter) mList.getAdapter()).setData(data);
//	}
	
}